import time,os
from selenium import webdriver
from selenium.webdriver.common.by import By # todo:引入By方法，做selenium定位
option = webdriver.EdgeOptions() # todo：chrome浏览器配置项
option.add_experimental_option("detach", True)# todo：浏览器不会自动关闭

bro = webdriver.Edge(options=option) # todo：实例化driver
# executable_path：指定driver的路径
bro.get("https://www.baidu.com/") # todo：打开一个浏览器页面
bro.maximize_window() # todo：浏览器放大
#bro.minimize_window() # todo:浏览器缩小
time.sleep(2) # todo：强制等待2s
bro.find_element(By.ID, "kw").send_keys("selenium")

time.sleep(3)
bro.find_element(By.ID, "su").click()
time.sleep(3)